package net.zoneland.knowledge.service.impl;

import net.zoneland.knowledge.dao.AttachmentPreviewAppKeyMapper;
import net.zoneland.knowledge.model.AttachmentPreviewAppKey;
import net.zoneland.knowledge.service.PreviewAppKeyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * appkey服务.
 */
@Service
public class PreviewAppKeyServiceImpl implements PreviewAppKeyService {

    @Autowired
    private AttachmentPreviewAppKeyMapper previewAppKeyMapper;

    /**
     * 从数据库加载appkey信息.
     *
     * @return
     */
    @Override
    public AttachmentPreviewAppKey queryAppKey() {
        return previewAppKeyMapper.selectAppKey();
    }

    /**
     * 更新appkey状态
     *
     * @param id
     * @return
     */
    @Override
    public int update(String id) {
        return previewAppKeyMapper.updateByPrimaryKey(id);
    }

    /**
     * 存储appkey信息.
     *
     * @param previewAppKey
     * @return
     */
    @Override
    public int insert(AttachmentPreviewAppKey previewAppKey) {
        return previewAppKeyMapper.insert(previewAppKey);
    }
}
